package lucky.ssmm.sys.controller;

import javax.servlet.http.HttpServletRequest;

import lucky.ssmm.sys.model.User;
import lucky.ssmm.sys.service.UserServiceI;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/userController")
public class UserController {

    private UserServiceI userService;
    
    
    public UserServiceI getUserService() {
        return userService;
    }

    @Autowired
    public void setUserService(UserServiceI userService) {
        this.userService = userService;
    }

    @RequestMapping("/{id}/showUser")
    public String showUser(@PathVariable String id, HttpServletRequest request) {
        User u = userService.getUserById(id);
        request.setAttribute("user", u);
        return "showUser";
    }
}
